//
//  GetInfoClass.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/10/19.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "GetInfoClass.h"

#import "JTCSM.h"

static GetInfoClass *single = nil;

@implementation GetInfoClass

+ (GetInfoClass *)shareSingle
{
    @synchronized(self){
        if(single == nil){
            single =[ [GetInfoClass alloc] init];
        }
        
    }
    return single;
}


- (void)getinfo{
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:2];
    LoadData *request = [[LoadData alloc]init];
    [dict setObject:KTokenString==nil?@"":KTokenString forKey:@"token"];
    [request loadDataPostAsynchronousWithURL:KURLPOSTHeadr(@"User/detail") withDict:dict superView:nil isAddtag:NO  Block:^(id result) {
        
        NSString *isreturn = [NSString stringWithFormat:@"%@",[result objectForKey:@"status"]];
        if ([isreturn isEqualToString:@"1"]) {
            
            NSDictionary *dict = [result objectForKey:@"data"];
            
            if (_myblock) {
                _myblock([UserInfoModel whc_ModelWithJson:dict]);
            }
        }else{
            [df showAlertWithTitle:[result objectForKey:@"msg"] message:nil btn1:@"返回" btn2:nil btn3:nil delegate:nil tag:0];
            //            [self theRequestOftuwenyanzhengma];
        }
        
    }];

}

- (void)getBanbeninfo{
//    User/version
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:2];
    LoadData *request = [[LoadData alloc]init];
    [dict setObject:KTokenString==nil?@"":KTokenString forKey:@"token"];
    [request loadDataPostAsynchronousWithURL:KURLPOSTHeadr(@"User/version") withDict:dict superView:nil isAddtag:NO  Block:^(id result) {
        
        NSString *isreturn = [NSString stringWithFormat:@"%@",[result objectForKey:@"status"]];
        if ([isreturn isEqualToString:@"1"]) {
            
            NSDictionary *dict = [result objectForKey:@"data"];
            
            if (_myblock) {
                _myblock([UserInfoModel whc_ModelWithJson:dict]);
            }
        }else{
            [df showAlertWithTitle:[result objectForKey:@"msg"] message:nil btn1:@"返回" btn2:nil btn3:nil delegate:nil tag:0];
            //            [self theRequestOftuwenyanzhengma];
        }
        
    }];

}
@end
